Free PDK is an open sourced and independently created tool-chain for the Padauk 8-Bit Microcontrollers, created as an alternative to the proprietary and closed tools provided by the Taiwanese company itself.

This includes the EasyPDKProg µC programmer hardware, adding support for the Padauk µCs to the SDCC C-Compiler, as well as comprehensive documentation of the instruction set architecture, and code examples.

The main focus is on supporting µCs of two Padauk series:

Padauk µCs are extremely inexpensive, priced as low as $0.03/pc in volumes of 100, which is why they generated a lot of interest after being featured by Dave from the EEVblog (first video and a bunch of follow-up videos). Despite the low price, it was found that the Padauk µCs sport an interesting architecture that can be a seen as a significant and meaningful extension of the Microchip PIC architecture. There is an extensive and active discussion on the EEVblog forum for this project and further discussion here on µC.net (German).

This page provides an overview of the different sub-projects created in the free-pdk GitHub organization. It also provides custom pinout diagrams for some of the Padauk µCs.

:link: Easy PDK Programmer

Image of the Programmer

Padauk µCs are programmed via a proprietary high-voltage protocol. The protocol was reverse engineered and a fully open source programmer that already supports almost two dozen Padauk µCs has been created. All sources for the programmer are available at:

:link: SDCC-based Open Source Tool-Chain

Padauk’s own tool-chain is based on a custom programming language called “Mini-C” with a syntax based on the C-language. This language is only supported by their own tool-chain, including IDE (“Padauk Developer Studio”) and programmer (“Writer”). The tool-chain also uses a custom binary format with encryption/obfuscation. Should you be interested in code samples in that custom language, take a look at free-pdk/fppa-code-examples.

The open source tool-chain is based on the Small Device C-Compiler (SDCC) and therefore does support Standard C and common binary output formats (intel hex and bin), including those used by the Easy PDK Programmer.

Please note that right now there is no interchangeability between both tool-chains. Binaries generated by SDCC cannot be written by the official Padauk programmer, but only by the Easy PDK Programmer.

Padauk µCs use different kinds of instruction sets: 13, 14, 15, or 16 bit (more information on these instruction sets can be found below). Support for the 14 and 15 bit Padauk instruction sets has been added to SDCC, a C compiler for small devices. Support for the 13 bit Padauk instruction set is being worked on.

Helpful SDCC resources:

:link: Installing SDCC

The latest binaries and sources of SDCC can be obtained on the SDCC website. If SDCC is available via your operating system’s package manager, please ensure that it is at least SDCC 4.0.0; older versions may not have support or only limited support for the Padauk µC.

:link: µC-specific Information and Pinouts

Note: Other µCs than the µCs listed here may be supported. If you want to learn more about the naming scheme, read more here.

:link: MTP (Flash) Variants

MCU OSS Status Arch. max IO ROM RAM Timers PWM CMP ADC Special Padauk Links
PFS154 Supported PDK14 14

2 KW

128 T16
T2 T3
2x 8‑Bit
3x 11‑Bit
1 LCD Product Page
Datasheet
PFS172 Supported PDK14 14

2 KW

128 T16
T2 T3
2x 8‑Bit 1 8‑Bit Product Page
Datasheet
PFS173 Supported PDK15 18

3 KW

256 T16
T2 T3
2x 8‑Bit
3x 11‑Bit
1 8‑Bit LCD Product Page
Datasheet

:link: OTP Variants

MCU OSS Status Arch. max IO ROM RAM Timers PWM CMP ADC Special Padauk Links
PMS150C Supported PDK13 6

1 KW

64 T16
T2
1x 8‑Bit 1 - Product Page
Datasheet
PMS15A Supported PDK13 6

0.5 KW
 (1 KW *)

64 T16
T2
1x 8‑Bit 1 - Product Page
Datasheet
PMS152 Supported PDK14 14

1.25 KW

80 T16
T2
1x 8‑Bit
3x 11‑Bit
1 - Product Page
Datasheet
PMS154C Supported PDK14 14

2 KW

128 T16
T2 T3
2x 8‑Bit
3x 11‑Bit
1 LCD Product Page
Datasheet
PMS171B Supported PDK14 14

1.5 KW

96 T16
 T2 T3
2x 8‑Bit 1 8‑Bit - Product Page
Datasheet

:link: Evaluation Boards

These are evaluation boards for the online-programmable MTP (as opposed to the OTP parts, which can only be programmed offline and once) Padauk µC. free-pdk/f-eval-boards.

:link: Instruction Sets, Opcodes, and Programming Sequence

The different Padauk µCs use either 13, 14, 15, or 16 bit instruction sets. The following files provide an overview over the different instruction sets.

More information, including information on the programming sequence, can be found at free-pdk/fppa-pdk-documentation

:link: Other Tools

  • Schematic Symbols: A collection of schematic symbols for many of the Padauk µCs.
  • Padauk µC Emulator written in VHDL: This project aims to provide a fully functional, timing accurate VHDL model for simulating PADAUK FPPA microcontrollers. free-pdk/fppa-pdk-emulator-vhdl
  • A bunch more tools are located at free-pdk/fppa-pdk-tools.
    • Disassembler: dispdk supports 13 bit, 14 bit, 15 bit and 16 bit opcodes
    • Emulator: emupdk supports 14 bit opcodes, no peripheral support yet requires mapping of processor ID in emucpu.c
    • PDK converter: depdk convert/deobfuscate any PDK file to binary

:link: Projects from the Community

These projects are auto-populated once per day by searching GitHub for repositories with the padauk topic. Projects that additionally have the free-pdk topic are highlighted as Uses Free PDK toolchain. Projects that contain .PRE files are marked as Uses proprietary toolchain.

:link: Latest Activity

The latest activity in the free-pdk GitHub organization is fetched at least once per day and displayed below.

avatar image

@spth commented on pull request free-pdk/free-pdk-examples#15
Attempt to make Serial_HelloWorld compatible with SDCC 4.4.0
Compiling that Serial_HelloWorld, which has both, it looks like there is no difference:

~~~~
; ../include/serial.h: 28: __set0io(PA, SERIAL_TX_PIN); // Send 0 on TX Pin
set0.io __pa, #7
~~~~

vs.

~~~~
; ../include/serial.h: 39: INTEN &= ~INTEN_TM2; // Disable TM2 (setup of 16 bit value txdata is non atomic)
set0.io __inten, #6
~~~~

Philipp


avatar image

@cpldcpu commented on pull request free-pdk/free-pdk-examples#15
Attempt to make Serial_HelloWorld compatible with SDCC 4.4.0
>Do we really need those asm __set1io and __set0io? Why not just use &= and |= with suitable masks?

I believe older versions of SDCC were not able to infer the set instruction for different memory types. Is that now all fixed?


avatar image

@spth commented on pull request free-pdk/free-pdk-examples#15
Attempt to make Serial_HelloWorld compatible with SDCC 4.4.0
I didn't try it, but from a quick look at the diff it looks ok to me, and should do what the title claims.

Two questions:
* What is the motivation for the PFS154->PFS173 change?
* Do we really need those asm `__set1io` and `__set0io`? Why not just use `&=` and `|=` with suitable masks?


avatar image

@jz13138 commented on issue free-pdk/free-pdk-examples#13
Serial_HelloWorld example does not work when compiled with SDCC4.4.0
done.


avatar image

@cpldcpu commented on issue free-pdk/free-pdk-examples#13
Serial_HelloWorld example does not work when compiled with SDCC4.4.0
Nice, thank you! Would you be willing to provide your diff as a pull request?


avatar image

@jz13138 commented on issue free-pdk/free-pdk-examples#13
Serial_HelloWorld example does not work when compiled with SDCC4.4.0
Got it working:
![grafik](https://github.com/free-pdk/free-pdk-examples/assets/164887846/da917ff1-e57b-406f-974c-24a8e52029a9)


```diff

diff --git a/Serial_HelloWorld/Makefile b/Serial_HelloWorld/Makefile
index 920f9e9..f025148 100644
--- a/Serial_HelloWorld/Makefile
+++ b/Serial_HelloWorld/Makefile
@@ -1,5 +1,5 @@

-DEVICE = PFS154
+DEVICE = PFS173
F_CPU = 8000000
TARGET_VDD_MV = 4000
TARGET_VDD = 4.0
diff --git a/SleepWake/Makefile b/SleepWake/Makefile
index 49bf6ee..531d2e6 100644
--- a/SleepWake/Makefile
+++ b/SleepWake/Makefile
@@ -1,6 +1,6 @@

-DEVICE = PFS154
-F_CPU = 70000
+DEVICE = PFS173
+F_CPU = 8000000
TARGET_VDD_MV = 4000
TARGET_VDD = 4.0

@@ -20,7 +20,7 @@ SOURCES = main.c
OBJECTS = $(patsubst %.c,$(BUILD_DIR)/%.rel,$(SOURCES))

# http://sdcc.sourceforge.net/doc/sdccman.pdf
-COMPILE = sdcc -m$(ARCH) -c --std-sdcc11 --opt-code-size -D$(DEVICE) -DF_CPU=$(F_CPU) -DTARGET_VDD_MV=$(TARGET_VDD_MV) -I. -I$(ROOT_DIR)/include
+COMPILE = sdcc -m$(ARCH) -c --std-sdcc11 --opt-code-size --fverbose-asm -D$(DEVICE) -DF_CPU=$(F_CPU) -DTARGET_VDD_MV=$(TARGET_VDD_MV) -I. -I$(ROOT_DIR)/include
LINK = sdcc -m$(ARCH)
EASYPDKPROG = easypdkprog

diff --git a/SleepWake/main.c b/SleepWake/main.c
index a07ddd9..1ae9963 100644
--- a/SleepWake/main.c
+++ b/SleepWake/main.c
@@ -43,7 +43,8 @@ void main(void) {
setup();

// Main processing loop
- while (1) {
+ while (1)
+ {
for (int i = 0; i < 3; i++) {
turnLedOn();
_delay_ms(400);
@@ -51,7 +52,7 @@ void main(void) {
_delay_ms(400);
}

- sleep();
+ //sleep();
}
}

diff --git a/include/delay.h b/include/delay.h
index d189df9..d577a37 100644
--- a/include/delay.h
+++ b/include/delay.h
@@ -59,7 +59,7 @@ __asm
subc __delay_loop_16_PARM_1+1 ; 1 cycle
mov a, __delay_loop_16_PARM_1+0 ; 1 cycle
or a, __delay_loop_16_PARM_1+1 ; 1 cycle
- t1sn f, z ; 1 cycle + 1 cycle for final skip
+ t1sn.io f, z ; 1 cycle + 1 cycle for final skip
goto 00001$ ; 2 cycles
// ret ; 2 cycles
__endasm;
@@ -88,7 +88,7 @@ __asm
or a, __delay_loop_32_PARM_1+1 ; 1 cycle
or a, __delay_loop_32_PARM_1+2 ; 1 cycle
or a, __delay_loop_32_PARM_1+3 ; 1 cycle
- t1sn f, z ; 1 cycle + 1 cycle for final skip
+ t1sn.io f, z ; 1 cycle + 1 cycle for final skip
goto 00001$ ; 2 cycles
// ret ; 2 cycles
__endasm;
diff --git a/include/pdk/util.h b/include/pdk/util.h
index 0838541..7b5563d 100644
--- a/include/pdk/util.h
+++ b/include/pdk/util.h
@@ -29,9 +29,10 @@

//macros so we can use defines in assembler strings
#define _STRINGIFY(x) #x
-#define _STR(x) _STRINGIFY(x)
#define _STR_VAR(x) "_"_STRINGIFY(x)
+#define _STR(x) _STRINGIFY(x)
#define _VAR(x) _ ## x
+#define _ASMS(x) VAR(x)

//definitions for built in opcodes
#define __nop() __asm__("nop\n")
@@ -41,8 +42,8 @@
#define __stopexe() __asm__("stopexe\nnop\n")
#define __reset() __asm__("reset\n")
#define __wdreset() __asm__("wdreset\n")
-#define __set0(var,bit) __asm__("set0 "_STR_VAR(var)", #"_STR(bit)"\n")
-#define __set1(var,bit) __asm__("set1 "_STR_VAR(var)", #"_STR(bit)"\n")
+#define __set0io(x,y) __asm__("set0.io "_STR_VAR(x)", #"_STR(y)"\n")
+#define __set1io(x,y) __asm__("set1.io "_STR_VAR(x)", #"_STR(y)"\n")

// BIT definitions
#define BIT0 (1)
diff --git a/include/serial.h b/include/serial.h
index 913d32f..16b7eeb 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -23,9 +23,9 @@ void serial_setup() {
void serial_irq_handler() {
if (txdata) { // Does txdata contains bits to send?
if (txdata & 0x01) // Check bit (1/0) for sending
- __set1(PA, SERIAL_TX_PIN); // Send 1 on TX Pin
+ __set1io(PA, 7); // Send 1 on TX Pin
else
- __set0(PA, SERIAL_TX_PIN); // Send 0 on TX Pin
+ __set0io(PA, SERIAL_TX_PIN); // Send 0 on TX Pin
txdata >>= 1; // Shift txdata
}
}

```


avatar image

@cpldcpu commented on issue free-pdk/free-pdk-examples#13
Serial_HelloWorld example does not work when compiled with SDCC4.4.0
Thank you for looking into this!

Strangely enough, I also had issues where no error occured, but this example still would not work.
Does Helloworld work for you`in SDCC4.4.0 after implementing these changes?


avatar image

@angyongen commented on issue free-pdk/free-pdk-examples#13
Serial_HelloWorld example does not work when compiled with SDCC4.4.0
i found the actual place that needs to be modified is util.h

```
#define __set0(var,bit) __asm__("set0 "_STR_VAR(var)", #"_STR(bit)"\n")
#define __set1(var,bit) __asm__("set1 "_STR_VAR(var)", #"_STR(bit)"\n")
```


```
#define __set0(var,bit) __asm__("set0.io "_STR_VAR(var)", #"_STR(bit)"\n")
#define __set1(var,bit) __asm__("set1.io "_STR_VAR(var)", #"_STR(bit)"\n")
```


avatar image

@angyongen commented on issue free-pdk/free-pdk-examples#13
Serial_HelloWorld example does not work when compiled with SDCC4.4.0
yes i had similar issue
for me i had to
```
__asm
set1.io __pa, # SERIAL_TX_PIN
__endasm;
```
instead of
` //__set1(PA, SERIAL_TX_PIN); // Send 1 on TX Pin`


avatar image
@cpldcpu pushed to free-pdk/free-pdk.github.io
  • 4b8b488 Initial commit
  • d44233a Create PADAUK_FPPA_14_bit_instruction_set.html
  • b90e231 Create index.html
  • 72f64e8 Update PADAUK_FPPA_14_bit_instruction_set.html
  • e8a54e3 update
  • ea3fc30 update
  • 86f8356 Create PADAUK_FPPA_13_bit_instruction_set.html
  • e083b7f changed LDSPTL / LDSPTH
  • 81201e5 Update index.html
  • fc38893 Update PADAUK_FPPA_13_bit_instruction_set.html
  • 5b2c347 Update PADAUK_FPPA_13_bit_instruction_set.html
  • 9e38729 Update PADAUK_FPPA_13_bit_instruction_set.html
  • a67afdf Create PADAUK_FPPA_16_bit_instruction_set.html
  • 87e70b3 Update index.html
  • cf26f96 Update index.html
  • 472bd15 add pinouts of some variants
  • f9c43b7 Create README.md
  • 8b027f6 Create PADAUK_FPPA_15_bit_instruction_set.html
  • 44e16cc Update PADAUK_FPPA_16_bit_instruction_set.html
  • 37f254e Update PADAUK_FPPA_14_bit_instruction_set.html

avatar image
@cpldcpu pushed to free-pdk/free-pdk-examples